package com.java.crazy.part17.net;

import com.java.crazy.base.BaseClass;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

public class MyClient extends BaseClass {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 30001);
        new Thread(new ClientThread(socket)).start();
        String msg = null;
        PrintStream printStream = new PrintStream(socket.getOutputStream());
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        while ((msg = bufferedReader.readLine()) != null) {
            logi(msg);
            printStream.print(msg);
        }
    }
}
